﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Search.aspx.cs" Inherits="RCREEE.Web.Search" Culture="auto" meta:resourcekey="PageResource1"
    UICulture="auto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100px;
        }
        .style2
        {
            width: 15%;
        }
    </style>
    <div id="header">
        <div id="section">
            <table width="100%">
                <tr>
                    <td width="20%" align="center" valign="middle">
                        <img src="Images/LogoRCREEE_Transparent.png" width="200px" />
                    </td>
                    <td width="60%" align="center" valign="middle">
                        <img src="Images/areeed-ba-txtr.png" width="600px" />
                    </td>
                    <td width="25%" align="center" valign="top">
                        <img src="Images/las-logo.png" width="85px" />
                    </td>
                </tr>
            </table>
        </div>
        <ul>
            <li><a href="Default.aspx">Home</a></li>
            <li><a href="Index.aspx">Index</a></li>
            <li><a href="Topics.aspx">Topics</a></li>
            <li><a href="CountrySelector.aspx">Countries</a></li>
            <li><a href="Aboutus.aspx">About Us</a></li>
            <li><a href="contactus.aspx">Contact us</a></li>
        </ul>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="scriptMan" runat="server">
    </asp:ScriptManager>
    <br />
    <asp:UpdateProgress ID="Up1" runat="Server" AssociatedUpdatePanelID="mainUpdatePanel">
        <ProgressTemplate>
            <div class="progressBackgroundFilter">
            </div>
            <div class="processMessage">
                Loading...<br />
                <br />
                <img alt="Loading..." src="Images/Loading.gif" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="mainUpdatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <table width="50%">
                <tr>
                    <td class="style1">
                        <asp:Label ID="lblSearchFor" runat="server" Text="Search For" meta:resourcekey="lblSearchForResource1" />
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlSearchFor" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSearchFor_SelectedIndexChanged"
                            Width="100%" meta:resourcekey="ddlSearchForResource1">
                            <asp:ListItem Value="0" meta:resourcekey="ListItemResource1"></asp:ListItem>
                            <asp:ListItem Text="Projects" Value="1" meta:resourcekey="ListItemResource2"></asp:ListItem>
                            <asp:ListItem Text="Contacts" Value="2" meta:resourcekey="ListItemResource3"></asp:ListItem>
                            <asp:ListItem Text="Items & Cadres" Value="3" meta:resourcekey="ListItemResource4"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        <asp:Label ID="label1" runat="server" Text="Country" meta:resourcekey="label1Resource1"></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlCountries" runat="server" DataSourceID="odsCountriesDDL"
                            DataTextField="CountryName" DataValueField="CountryId" Width="100%" AutoPostBack="True"
                            meta:resourcekey="ddlCountriesResource1">
                        </asp:DropDownList>
                    </td>
                </tr>
            </table>
            <asp:ObjectDataSource ID="odsCountriesDDL" runat="server" SelectMethod="GetAllCountries"
                TypeName="RCREEE.Library.DataManager">
                <SelectParameters>
                    <asp:SessionParameter DefaultValue="1033" Name="LanguageCode" SessionField="LanguageCode"
                        Type="Int32" />
                    <asp:Parameter DefaultValue="" Name="FirstItem" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <table width="100%">
                <tr>
                    <td>
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="pnlSearchTypes">
                            <ProgressTemplate>
                                <div class="progressBackgroundFilter">
                                </div>
                                <div class="processMessage">
                                    Loading...<br />
                                    <br />
                                    <img alt="Loading..." src="Images/Loading.gif" />
                                </div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                        <asp:UpdatePanel ID="pnlSearchTypes" runat="server">
                            <ContentTemplate>
                                <asp:MultiView ID="mlvSearchTypes" runat="server">
                                    <asp:View ID="viewProjectSearch" runat="server">
                                        <br />
                                        <asp:Panel ID="ProjectSearchPanel" runat="server" GroupingText="Projects Search"
                                            meta:resourcekey="ProjectSearchPanelResource1">
                                            <br />
                                            <table width="100%" align="center">
                                                <tr align="center">
                                                    <td style="width: 25%">
                                                        <asp:Label ID="lblProjectGroup" runat="server" Text="Project Group" meta:resourcekey="lblProjectGroupResource1" />
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:Label ID="lblProjectType" runat="server" Text="Project Type" meta:resourcekey="lblProjectTypeResource1" />
                                                    </td>
                                                    <td style="width: 50%">
                                                        <asp:Label ID="lblProjectRecord" runat="server" Text="Record" meta:resourcekey="lblProjectRecordResource1" />
                                                    </td>
                                                </tr>
                                                <tr align="center">
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlProjectGroup" runat="server" AutoPostBack="True" DataSourceID="odsProjectGroups"
                                                            DataTextField="Name" DataValueField="ID" meta:resourcekey="ProjectGroupResource1"
                                                            Width="100%">
                                                        </asp:DropDownList>
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:UpdatePanel ID="pnlProjectType" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                                <asp:DropDownList ID="ddlProjectType" runat="server" DataSourceID="odsProjectTypes"
                                                                    DataTextField="Name" DataValueField="ID" meta:resourcekey="ddTypeEditResource1"
                                                                    Width="100%" AutoPostBack="True">
                                                                </asp:DropDownList>
                                                            </ContentTemplate>
                                                            <Triggers>
                                                                <asp:AsyncPostBackTrigger ControlID="ddlProjectGroup" EventName="SelectedIndexChanged" />
                                                            </Triggers>
                                                        </asp:UpdatePanel>
                                                    </td>
                                                    <td style="width: 50%">
                                                        <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="pnlProjectRecords">
                                                            <ProgressTemplate>
                                                                <div class="progressBackgroundFilter">
                                                                </div>
                                                                <div class="processMessage">
                                                                    Loading...<br />
                                                                    <br />
                                                                    <img alt="Loading..." src="Images/Loading.gif" />
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdatePanel ID="pnlProjectRecords" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                                <asp:DropDownList ID="ddlProjectRecord" runat="server" Width="100%" DataSourceID="odsAvailableProjects"
                                                                    DataTextField="Name" DataValueField="ID" meta:resourcekey="ddlProjectRecordResource1">
                                                                </asp:DropDownList>
                                                            </ContentTemplate>
                                                            <Triggers>
                                                                <asp:AsyncPostBackTrigger ControlID="ddlProjectGroup" EventName="SelectedIndexChanged" />
                                                                <asp:AsyncPostBackTrigger ControlID="ddlProjectType" EventName="SelectedIndexChanged" />
                                                                <asp:AsyncPostBackTrigger ControlID="ddlCountries" EventName="SelectedIndexChanged" />
                                                            </Triggers>
                                                        </asp:UpdatePanel>
                                                    </td>
                                                </tr>
                                            </table>
                                            <asp:ObjectDataSource ID="odsProjectGroups" runat="server" SelectMethod="Search_GetProjectGroups"
                                                TypeName="RCREEE.Library.Search">
                                                <SelectParameters>
                                                    <asp:SessionParameter DefaultValue="1033" Name="LanguageCode" SessionField="LanguageCode"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:ObjectDataSource ID="odsProjectTypes" runat="server" SelectMethod="Search_GetProjectTypes"
                                                TypeName="RCREEE.Library.Search">
                                                <SelectParameters>
                                                    <asp:SessionParameter DefaultValue="1033" Name="LanguageCode" SessionField="LanguageCode"
                                                        Type="Int32" />
                                                    <asp:ControlParameter ControlID="ddlProjectGroup" Name="ProjectGroupId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:ObjectDataSource ID="odsAvailableProjects" runat="server" SelectMethod="Search_GetAvailableProjects"
                                                TypeName="RCREEE.Library.Search">
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="ddlCountries" Name="CountryId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                    <asp:ControlParameter ControlID="ddlProjectGroup" Name="ProjectGroupId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                    <asp:ControlParameter ControlID="ddlProjectType" Name="ProjectTypeId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                    <asp:SessionParameter DefaultValue="1033" Name="LanguageCode" SessionField="LanguageCode"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <br />
                                        </asp:Panel>
                                    </asp:View>
                                    <asp:View ID="viewContactSearch" runat="server">
                                        <br />
                                        <asp:Panel ID="ContactSearchPanel" runat="server" GroupingText="Entity Search" meta:resourcekey="ContactSearchPanelResource1">
                                            <br />
                                            <table width="100%" align="center">
                                                <tr align="center">
                                                    <td style="width: 25%">
                                                        <asp:Label ID="label2" runat="server" Text="Category" meta:resourcekey="label2Resource1"></asp:Label>
                                                    </td>
                                                    <td style="width: 50%">
                                                        <asp:Label ID="label3" runat="server" Text="Record" meta:resourcekey="label3Resource1"></asp:Label>
                                                    </td>
                                                </tr>
                                                <tr align="center">
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlContactEntities" runat="server" DataSourceID="odsContactEntities"
                                                            DataTextField="Name" DataValueField="ID" Width="100%" AutoPostBack="True" meta:resourcekey="ddlContactEntitiesResource1">
                                                        </asp:DropDownList>
                                                    </td>
                                                    <td style="width: 50%">
                                                        <asp:UpdateProgress ID="UpdateProgress3" runat="server" AssociatedUpdatePanelID="pnlContactRecords">
                                                            <ProgressTemplate>
                                                                <div class="progressBackgroundFilter">
                                                                </div>
                                                                <div class="processMessage">
                                                                    Loading...<br />
                                                                    <br />
                                                                    <img alt="Loading..." src="Images/Loading.gif" />
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdatePanel ID="pnlContactRecords" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
                                                            <ContentTemplate>
                                                                <asp:DropDownList ID="ddlContactRecord" runat="server" Width="100%" DataSourceID="odsAvailableContacts"
                                                                    DataTextField="Name" DataValueField="ID" meta:resourcekey="ddlContactRecordResource1">
                                                                </asp:DropDownList>
                                                            </ContentTemplate>
                                                            <Triggers>
                                                                <asp:AsyncPostBackTrigger ControlID="ddlCountries" EventName="SelectedIndexChanged" />
                                                                <asp:AsyncPostBackTrigger ControlID="ddlContactEntities" EventName="SelectedIndexChanged" />
                                                            </Triggers>
                                                        </asp:UpdatePanel>
                                                    </td>
                                                </tr>
                                            </table>
                                            <asp:ObjectDataSource ID="odsContactEntities" runat="server" SelectMethod="GetEntitiesByEntityTypeIdForDDL"
                                                TypeName="RCREEE.Library.DataManager">
                                                <SelectParameters>
                                                    <asp:Parameter DefaultValue="121" Name="EntityTypeId" Type="Int32" />
                                                    <asp:SessionParameter DefaultValue="1033" Name="LanguageCode" SessionField="LanguageCode"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:ObjectDataSource ID="odsAvailableContacts" runat="server" SelectMethod="Search_GetAvailableContacts"
                                                TypeName="RCREEE.Library.DataManager">
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="ddlCountries" Name="CountryId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                    <asp:ControlParameter ControlID="ddlContactEntities" Name="EntityId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                    <asp:SessionParameter DefaultValue="1033" Name="LanguageCode" SessionField="LanguageCode"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <br />
                                        </asp:Panel>
                                    </asp:View>
                                    <asp:View ID="ViewItemsCadresSeach" runat="server">
                                        <br />
                                        <asp:Panel ID="pnlItemsAndCadres" runat="server" GroupingText="Items & Cadres Search"
                                            meta:resourcekey="pnlItemsAndCadresResource1">
                                            <br />
                                            <table width="100%">
                                                <tr>
                                                    <td class="style2">
                                                        <asp:Label ID="lblKeyWord" runat="server" Text="Key Word" meta:resourcekey="lblKeyWordResource1" />
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txtKeyWord" runat="server" Width="100%" meta:resourcekey="txtKeyWordResource1" />
                                                    </td>
                                                </tr>
                                            </table>
                                            <br />
                                        </asp:Panel>
                                    </asp:View>
                                </asp:MultiView>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click"
                            Visible="False" meta:resourcekey="btnSearchResource1" />
                    </td>
                </tr>
            </table>
            <asp:UpdateProgress ID="UpdateProgress4" runat="server" AssociatedUpdatePanelID="ResultsUpdatPanel">
                <ProgressTemplate>
                    <div class="progressBackgroundFilter">
                    </div>
                    <div class="processMessage">
                        Loading...<br />
                        <br />
                        <img alt="Loading..." src="Images/Loading.gif" />
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>
            <asp:UpdatePanel ID="ResultsUpdatPanel" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:DataList ID="dlSearchResults" runat="server" CellPadding="4" ForeColor="#333333"
                        Width="100%" meta:resourcekey="dlSearchResultsResource1">
                        <AlternatingItemStyle BackColor="White" />
                        <FooterStyle BackColor="#0268b0" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#0268b0" Font-Bold="True" ForeColor="White" />
                        <ItemStyle BackColor="#EAEAEA" ForeColor="#333333" />
                        <ItemTemplate>
                            <li><a href='<%# Eval("URL") %>' target="_blank">
                                <%# Eval("Name")%></a></li>
                        </ItemTemplate>
                        <SelectedItemStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="#990000" />
                        <HeaderTemplate>
                            Search Results
                        </HeaderTemplate>
                    </asp:DataList>
                    <asp:Label ID="lblNoDataAvailable" runat="server" Text="No search results!" Visible="False"
                        meta:resourcekey="lblNoDataAvailableResource1" />
                    <br />
                </ContentTemplate>
            </asp:UpdatePanel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
